package com.etc.zmall.service.impl;

import java.util.List;

import com.etc.util.MD5Util;
import com.etc.util.PageData;
import com.etc.zmall.dao.UserDao;
import com.etc.zmall.dao.impl.UserDaoImpl;
import com.etc.zmall.entity.User;
import com.etc.zmall.service.UserService;

/**
 * 
 * <p>
 * Title: UserServiceImpl
 * </p>
 * 
 * <p>
 * Description:
 * </p>
 * 
 * @author knowno
 * 
 * @date 2021年1月11日
 * 
 */
public class UserServiceImpl implements UserService {

	UserDao ud = new UserDaoImpl();

	@Override
	public User login(String username, String pwd) {
		// 将密码转换为密文
		String userpwd = MD5Util.getEncodeByMd5(pwd);
		User user = ud.userLogin(username, userpwd);
		return user;
	}

	@Override
	public List<User> getUser() {
		// TODO Auto-generated method stub
		return ud.getUser("");
	}

	@Override
	public User getUsersByName(String username) {
		// TODO Auto-generated method stub
		return ud.getUserByName(username);
	}

	@Override
	public boolean setUserState(String username, int state) {
		return ud.proUser(username, state);
	}

	public PageData<User> getUserByPage(int pageNo, int pageSize, String keywords) {
		return ud.getUserByPage(pageNo, pageSize, keywords);
	}

}
